﻿Imports System.Xml

Public Class MarginPreference

	Property ColumnCount As Integer

	Property ColumnGutter As Double

	Property Top As Double

	Property Bottom As Double

	Property Left As Double

	Property Right As Double

	Property ColumnDirection As Object

	Property ColumnsPositions As String

	Public Shared Function ReadXml(reader As XmlReader) As MarginPreference
		Dim mp As New MarginPreference()

		If reader.HasAttributes Then
			mp.ColumnCount = CInt(reader.GetAttribute("ColumnCount"))
			mp.ColumnGutter = Parser.ParseDouble(reader.GetAttribute("ColumnGutter"))
			mp.Top = Parser.ParseDouble(reader.GetAttribute("Top"))
			mp.Bottom = Parser.ParseDouble(reader.GetAttribute("Bottom"))
			mp.Left = Parser.ParseDouble(reader.GetAttribute("Left"))
			mp.Right = Parser.ParseDouble(reader.GetAttribute("Right"))
			mp.ColumnDirection = [Enum].Parse(GetType(HorizontalOrVertical), reader.GetAttribute("ColumnDirection"))
			mp.ColumnsPositions = reader.GetAttribute("ColumnsPositions")
		End If

		Return mp
	End Function
End Class